package com.cstp.web;

import com.cstp.web.req.LoginUser;
import com.cstp.web.res.Resp;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author watts
 */
@RestController
public class LoginController {

    @PostMapping("/login")
    public Resp<String> login(@RequestBody @Valid LoginUser loginUser) {
        if ("admin".equals(loginUser.getName()) && "csjj@admnin".equals(loginUser.getPwd())) {
            return Resp.ok("xxx");
        }
        return Resp.fail("用户名密码错误");
    }
}
